import request from '@/utils/request'

// 查询库存盘点任务列表
export function listStockCheck(query) {
  return request({
    url: '/storehouse/stockCheck/list',
    method: 'get',
    params: query
  })
}
// 查询库存盘点差异列表
export function listCheckDiff(query) {
  return request({
    url: '/storehouse/checkDiff/list',
    method: 'get',
    params: query
  })
}
// 查询库存盘点任务明细列表
export function listCheckDetail(query) {
  return request({
    url: '/storehouse/stockCheckDetail/list',
    method: 'get',
    params: query
  })
}

// 查询库存盘点任务详细
export function getStockCheck(id) {
  return request({
    url: '/storehouse/stockCheck/' + id,
    method: 'get'
  })
}

// 新增库存盘点任务
export function addStockCheck(data) {
  return request({
    url: '/storehouse/stockCheck',
    method: 'post',
    data: data
  })
}

// 通过差异审核
export function reviewPass(data) {
  return request({
    url: '/storehouse/stockCheck/reviewPass',
    method: 'post',
    data: data
  })
}

// 拒绝差异审核
export function reviewFail(data) {
  return request({
    url: '/storehouse/stockCheck/reviewFail',
    method: 'post',
    data: data
  })
}

// 修改库存盘点任务
export function updateStockCheck(data) {
  return request({
    url: '/storehouse/stockCheck',
    method: 'put',
    data: data
  })
}

// 删除库存盘点任务
export function delStockCheck(id) {
  return request({
    url: '/storehouse/stockCheck/' + id,
    method: 'delete'
  })
}

// 开始库存盘点
export function startCheck(id) {
  return request({
    url: '/storehouse/stockCheck/startCheck/' + id,
    method: 'post'
  })
}

// 取消库存盘点
export function cancelCheck(id) {
  return request({
    url: '/storehouse/stockCheck/cancelCheck/' + id,
    method: 'post'
  })
}
// 提交差异申请
export function submitReview(id) {
  return request({
    url: '/storehouse/stockCheck/submitReview/' + id,
    method: 'post'
  })
}

// 库存盘点差异
export function listDifferenceDetail(query) {
  return request({
    url: '/storehouse/checkDiff/list',
    method: 'get',
    params: query
  })
}

// 分配库存盘点任务
export function changeDiffDesc(data) {
  return request({
    url: '/storehouse/checkDiff',
    method: 'put',
    data
  })
}

// 分配库存盘点任务
export function allocation(data) {
  return request({
    url: '/storehouse/stockCheck/allocation',
    method: 'put',
    data
  })
}

// 复盘库存盘点任务
export function createReCheck(id) {
  return request({
    url: '/storehouse/stockCheck/createReCheck/' + id,
    method: 'post',
  })
}

// 结束库存盘点任务
export function finishStockCheck(id) {
  return request({
    url: '/storehouse/stockCheck/finish/' + id,
    method: 'post',
  })
}

// 生成复盘
export function createReCheckDirect(id) {
  return request({
    url: '/storehouse/stockCheck/createReCheckDirect/' + id,
    method: 'post',
  })
}

